import { post, get, del } from "../utils/request";

/**
 * 查询课程信息视频总数
 * @returns
 */
export const CourseTotalAPI = (id) => get(`/api/course/courseDetail?id=${id}`);

/**
 * 根据课程ID查询视频信息
 * @returns
 */
export const CourseVideoAPI = (id) =>
  get(`/api/course/courseVideoCategory/select?id=${id}`);

/**
 * 分类
 * @param {*} id
 * @returns
 */
export const CategoryAPI = (id) => get(`/api/category/query/${id}`);

/**
 * 弹出层导航
 * @returns
 */
export const NavCategoryAPI = () => get(`/api/category/query/${0}`);

/**
 * 套餐树
 * @returns
 */
export const ComboTreeAPI = () => post("/api/combo2/combo2");

/**
 * 详情
 * @param {*} id
 * @returns
 */

export const ComboTreeDetailAPI = (id) =>
  post("/api/combo2/combo2", {
    id,
  });

/**
 * 订单
 * @param {*} id
 * @returns
 */
export const OrdersAPI = (id) => post("/api/orders/combo", { id });

/**
 * 添加购物车
 * @param {*} courseId
 * @returns
 */
export const addCartAPI = (
  uids,
  names,
  images,
  totalPrcies,
  videoNumbers,
  textNumbers,
  courseIds,
) =>
  post("/api/scart", {
    uid: uids,
    name: names,
    image: images,
    totalPrcie: totalPrcies,
    videoNumber: videoNumbers,
    textNumber: textNumbers,
    courseId: courseIds,
  });

/**
 * 删除购物车商品
 * @returns
 */
export const delCartAPI = (id) => del(`/api/scart/${id}`);


/**
 * 获取购物车信息
 * @returns
 */
export const loadCartAPI = () => get("/api/scart");
